package com.xiaofan.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;

/**
 * @author: 晓帆
 * @description:
 * @create: 2021-07-01 15:51
 **/
@RestController
@RequestMapping("upload")
public class FileUploadController {

    @RequestMapping("upload1")
    public String fileUpLoad(@RequestParam(value = "file") MultipartFile myfile) throws IOException {
        String originalFilename = myfile.getOriginalFilename();
        myfile.transferTo(new File("D://end",originalFilename));
        return "ok";
    }

}
